/**
 * Created by Administrator on 2016/8/16.
 */
$(function(){
    var  id = GetQueryString("id");
    $.ajax({
        type:'GET',
        url:host+"/news",
        data:{id:id},
        async:false,
        success:function (data) {
            showData(data);
        },
        error: function(XMLHttpRequest){
            alert( "请求错误 " + XMLHttpRequest.responseText);
        }
    });
});

function GetQueryString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}

function showData(data){

    $('#title').html(data.bean.title);
    $('#author').html(data.bean.author);
    $('#time').html(data.bean.addtime);
    $('#content').html(data.bean.content);
}


